package chapter03;

/**
 * 冒泡排序
 * Created by a on 2017/6/9.
 */
public class Test051 {
    public static void main(String[] args) {
        //定义待排序的数组
        int[] arrays = {1,5,7,9,3,0};

        for (int i = 1;i<arrays.length;i++){
            for (int j =0;j<arrays.length-i;j++){
                if (arrays[j]>arrays[j+1]){
                    int temp = arrays[j+1];
                    arrays[j+1] = arrays[j];
                    arrays[j] = temp;
                }
            }
        }

        for (int i : arrays){
            System.out.println(i);
        }


    }

}
